home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume11 / jove.pch / patch1 < prev    next >
Encoding:
Internet Message Format  |  1987-09-25  |  4.6 KB

  1. Subject:  v11i081:  Missing file from Jove update, Patch1
  2. Newsgroups: comp.sources.unix,comp.sources.bugs
  3. Sender: sources
  4. Approved: rs@uunet.UU.NET
  5.  
  6. Submitted-by: jpayne@cs.rochester.edu
  7. Posting-number: Volume 11, Issue 81
  8. Archive-name: jove.pch/patch1
  9.  
  10. [  We let this one slip by.  Sorry, folks.  --r$  ]
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of shell archive."
  18. # Contents:  argcount.c
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f argcount.c -a "${1}" != "-c" ; then 
  21.   echo shar: Will not over-write existing file \"argcount.c\"
  22. else
  23. echo shar: Extracting \"argcount.c\" \(3367 characters\)
  24. sed "s/^X//" >argcount.c <<'END_OF_argcount.c'
  25. X/************************************************************************
  26. X * This program is Copyright (C) 1986 by Jonathan Payne.  JOVE is       *
  27. X * provided to you without charge, and with no warranty.  You may give  *
  28. X * away copies of JOVE, including sources, provided that this notice is *
  29. X * included in all the files.                                           *
  30. X ************************************************************************/
  31. X
  32. X#include "jove.h"
  33. X#include <ctype.h>
  34. X
  35. Xprivate int    arg_supplied_p,
  36. X        arg_count;
  37. X
  38. Xarg_type()
  39. X{
  40. X    return arg_supplied_p;
  41. X}
  42. X
  43. Xset_is_an_arg(there_is)
  44. X{
  45. X    arg_supplied_p = there_is;
  46. X}
  47. X
  48. Xset_arg_value(n)
  49. X{
  50. X    arg_supplied_p = YES;
  51. X    arg_count = n;
  52. X}
  53. X
  54. Xnegate_arg_value()
  55. X{
  56. X    arg_count = -arg_count;
  57. X}
  58. X
  59. Xclr_arg_value()
  60. X{
  61. X    arg_supplied_p = NO;
  62. X    arg_count = 1;
  63. X}
  64. X
  65. X/* return whether there is currently a numeric argument */
  66. Xis_an_arg()
  67. X{
  68. X    return (arg_supplied_p != NO);
  69. X}
  70. X
  71. X/* return the numeric argument */
  72. Xarg_value()
  73. X{
  74. X    return arg_count;
  75. X}
  76. X
  77. X/* called by C-U to gather a numeric argument, either C-U's or digits,
  78. X   but not both */
  79. XTimesFour()
  80. X{
  81. X    quad_numeric_arg();
  82. X}
  83. X
  84. X/* This initializes the numeric argument to 1 and starts multiplying
  85. X   by 4 (the magic number Stallman came up with).  It is an error to
  86. X   invoke quad_numeric_arg() interactively (via TimesFour()), because
  87. X   it uses the LastKeyStruck variable to know what character signals
  88. X   to multiply again (in the loop). */
  89. Xprivate
  90. Xquad_numeric_arg()
  91. X{
  92. X    int    oldc = LastKeyStruck,
  93. X        newc,
  94. X        narg_count,
  95. X        slow;
  96. X
  97. X    slow = 0;
  98. X    arg_supplied_p = YES;
  99. X    arg_count = 1;
  100. X    this_cmd = ARG_CMD;
  101. X    do {
  102. X        if ((narg_count = arg_count * 4) != 0)
  103. X            arg_count = narg_count;
  104. X        if (!slow)
  105. X            newc = waitchar(&slow);
  106. X        else
  107. X            newc = getch();
  108. X        if (isdigit(newc) || newc == '-') {
  109. X             arg_supplied_p = NO;
  110. X             gather_numeric_argument(newc);
  111. X             return;
  112. X        }
  113. X        if (slow)
  114. X            message(key_strokes);
  115. X    } while (newc == oldc);
  116. X    Ungetc(newc);
  117. X}
  118. X
  119. Xprivate
  120. Xgather_numeric_argument(c)
  121. X{
  122. X    int    sign = 0;
  123. X    static int    digited;
  124. X    int    slow = 0;
  125. X
  126. X    if (!isdigit(c) && c != '-')
  127. X        complain((char *) 0);
  128. X    if (arg_supplied_p == NO) {    /* if we just got here */
  129. X        arg_count = 0;    /* start over */
  130. X        digited = NO;
  131. X    } else if (arg_supplied_p == YES_NODIGIT) {
  132. X        sign = (arg_count < 0) ? -1 : 1;
  133. X        arg_count = 0;
  134. X    }
  135. X
  136. X    if (!sign)
  137. X        sign = (arg_count < 0) ? -1 : 1;
  138. X    if (sign == -1)
  139. X        arg_count = -arg_count;
  140. X    if (c == '-') {
  141. X        sign = -sign;
  142. X        goto goread;
  143. X    }
  144. X    for (;;) {
  145. X        if (slow)
  146. X            message(key_strokes);
  147. X        if (isdigit(c)) {
  148. X            arg_count = (arg_count * 10) + (c - '0');
  149. X            digited = YES;
  150. X        } else {
  151. X            if (digited)
  152. X                arg_supplied_p = YES;
  153. X            else {
  154. X                arg_count = 1;
  155. X                if (arg_supplied_p == NO)
  156. X                    arg_supplied_p = YES_NODIGIT;
  157. X            }
  158. X            arg_count *= sign;
  159. X            this_cmd = ARG_CMD;
  160. X            Ungetc(c);
  161. X            return;
  162. X        }
  163. Xgoread:        if (!slow)
  164. X            c = waitchar(&slow);
  165. X        else {
  166. X            add_mess(NullStr);
  167. X            c = getch();
  168. X        }
  169. X    }
  170. X}
  171. X
  172. XDigit()
  173. X{
  174. X    gather_numeric_argument(LastKeyStruck);
  175. X}
  176. X
  177. XDigit0()
  178. X{
  179. X    gather_numeric_argument('0');
  180. X}
  181. X
  182. XDigit1()
  183. X{
  184. X    gather_numeric_argument('1');
  185. X}
  186. X
  187. XDigit2()
  188. X{
  189. X    gather_numeric_argument('2');
  190. X}
  191. X
  192. XDigit3()
  193. X{
  194. X    gather_numeric_argument('3');
  195. X}
  196. X
  197. XDigit4()
  198. X{
  199. X    gather_numeric_argument('4');
  200. X}
  201. X
  202. XDigit5()
  203. X{
  204. X    gather_numeric_argument('5');
  205. X}
  206. X
  207. XDigit6()
  208. X{
  209. X    gather_numeric_argument('6');
  210. X}
  211. X
  212. XDigit7()
  213. X{
  214. X    gather_numeric_argument('7');
  215. X}
  216. X
  217. XDigit8()
  218. X{
  219. X    gather_numeric_argument('8');
  220. X}
  221. X
  222. XDigit9()
  223. X{
  224. X    gather_numeric_argument('9');
  225. X}
  226. END_OF_argcount.c
  227. if test 3367 -ne `wc -c <argcount.c`; then
  228.     echo shar: \"argcount.c\" unpacked with wrong size!
  229. fi
  230. # end of overwriting check
  231. fi
  232. echo shar: End of shell archive.
  233. exit 0
  234.